package com.kamm.springbootflower.service;


import com.github.pagehelper.PageHelper;
import com.kamm.springbootflower.dao.FlowertypeMapper;
import com.kamm.springbootflower.domain.Flowertype;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FlowertypeServiceimpl implements FlowertypeService {

    @Resource
    FlowertypeMapper  flowertypeMapper;

    @Override
    public int deleteByPrimaryKey(Integer ftId) {
        return flowertypeMapper.deleteByPrimaryKey(ftId);
    }

    @Override
    public int insert(Flowertype flowertype) {
        return flowertypeMapper.insert(flowertype);
    }

    @Override
    public int insertSelective(Flowertype flowertype) {
        return flowertypeMapper.insertSelective(flowertype);
    }

    @Override
    public Flowertype selectByPrimaryKey(Integer ftId) {
        return flowertypeMapper.selectByPrimaryKey(ftId);
    }

    @Override
    public int updateByPrimaryKeySelective(Flowertype flowertype) {
        return flowertypeMapper.updateByPrimaryKeySelective(flowertype);
    }

    @Override
    public int updateByPrimaryKey(Flowertype flowertype) {
        return flowertypeMapper.updateByPrimaryKey(flowertype);
    }

    @Override
    public int count(Flowertype flowertype) {
        return flowertypeMapper.count(flowertype);
    }

    @Override
    public List<Flowertype> findAll(Flowertype flowertype, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Flowertype> list=flowertypeMapper.findAll(flowertype);
        if(list.size()>0 && list!=null){
            return list;
        }
       return null;
    }

    @Override
    public int update(Flowertype flowertype) {
        return  flowertypeMapper.updateByPrimaryKeySelective(flowertype);
    }

    @Override
    public int add(Flowertype flowertype) {
        return flowertypeMapper.insertSelective(flowertype);
    }

    @Override
    public int deleteAll(String[] ids) {
        if(ids!=null&&ids.length>0){
            return flowertypeMapper.deleteAll(ids);
        }
        return ' ';
    }

    @Override
    public List<Flowertype> findAll2() {
        List<Flowertype> list=flowertypeMapper.findAll2();
        if(list.size()>0&&list!=null){
            return list;
        }
        return null;
    }
}
